import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {JVxeColumn, JVxeTypes} from "@/components/jeecg/JVxeTable/src/types";
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '承接任务',
    align:"center",
    dataIndex: 'undertaketasks'
   },
   {
    title: '工作内容',
    align:"center",
    dataIndex: 'jobcontent'
   },
   {
    title: '完成期限',
    align:"center",
    dataIndex: 'deadlineforcompletion'
   },
   {
    title: '责任部门',
    align:"center",
    dataIndex: 'respondepart_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '承接任务',
    field: 'undertaketasks',
    component: 'Input',
    dynamicRules: () => {
          return [
                 { required: true, message: '请输入承接任务!'},
          ];
     },
    required: true,
  },
  {
    label: '工作内容',
    field: 'jobcontent',
    component: 'Input',
    dynamicRules: () => {
          return [
                 { required: true, message: '请输入工作内容!'},
          ];
     },
    required: true,
  },
  {
    label: '完成期限',
    field: 'deadlineforcompletion',
    component: 'DatePicker',
    componentProps: {
       showTime:true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
    dynamicRules: () => {
          return [
                 { required: true, message: '请输入完成期限!'},
          ];
     },
    required: true,
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const keyWorkDepartmentsColumns: JVxeColumn[] = [
    {
      title: '配合部门',
      key: 'coopDepart',
      type: JVxeTypes.select,
      dictCode:"sys_depart where depart_name like '%部' or depart_name like '%处',depart_name,id",
      width:"170px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '完成时间',
      key: 'finishedtime',
      type: JVxeTypes.datetime,
      width:"170px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '配合内容',
      key: 'coopcontent',
      type: JVxeTypes.input,
      width:"170px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '质量要求',
      key: 'qualityrequirements',
      type: JVxeTypes.input,
      width:"170px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]


// 高级查询数据
export const superQuerySchema = {
  undertaketasks: {title: '承接任务',order: 0,view: 'text', type: 'string',},
  jobcontent: {title: '工作内容',order: 1,view: 'text', type: 'string',},
  deadlineforcompletion: {title: '完成期限',order: 2,view: 'datetime', type: 'string',},
  respondepart: {title: '责任部门',order: 3,view: 'text', type: 'string',dictTable: "sys_depart", dictCode: 'id', dictText: 'depart_name',},
  //子表高级查询
  keyWorkDepartments: {
    title: '配合部门',
    view: 'table',
    fields: {
        coopDepart: {title: '配合部门',order: 0,view: 'text', type: 'string',dictTable: "sys_depart", dictCode: 'id', dictText: 'depart_name',},
        finishedtime: {title: '完成时间',order: 1,view: 'datetime', type: 'string',},
        coopcontent: {title: '配合内容',order: 2,view: 'text', type: 'string',},
        qualityrequirements: {title: '质量要求',order: 3,view: 'text', type: 'string',},
    }
  },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param _formData
 */
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
